package cn.edu.sig.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.sig.bean.CurrentPage;
import cn.edu.sig.bean.Goods;
import cn.edu.sig.dao.GoodsDao;

@Service("goodsService")
@Transactional
public class GoodsService {

	@Resource(name = "goodsDao")
	private GoodsDao goodsDao;

	public void addGoods(Goods goods) {

		goodsDao.add(goods);
	}
	
	public void deleteGoods(Integer goodsId) {

		goodsDao.delete(goodsId);
	}

	public List<Goods> findAllByGoods(Goods goods) {

		return goodsDao.findAllByGoods(goods);

	}

	public CurrentPage<Goods> findAllByUser(Goods goods, int pageNo,
			int pageSize) {

		return goodsDao.findAllByUser(goods, pageNo, pageSize);

	}

	public Goods findById(String goodsId) {

		return goodsDao.findById(goodsId);
	}
	
	public CurrentPage<Goods> findAllByUser(int pageNo,
			int pageSize) {

		return goodsDao.findAllByUser(pageNo, pageSize);

	}
	
}
